<template>
    <div class="login-wp">
      <div class="login-main">
          <form class="form-horizontal">
            <div class="form-group">
                <label for="inputEmail3" class="col-sm-2 control-label">账号</label>
                <div class="col-sm-10">
                <input type="email" v-model="userName" class="form-control" placeholder="请输入账号或手机号">
                </div>
            </div>
            <div class="form-group">
                <label for="inputPassword3" class="col-sm-2 control-label">密码</label>
                <div class="col-sm-10">
                <input type="password" v-model="password" class="form-control"  placeholder="请输入密码">
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                <button type="button" class="btn btn-default" @click="loginClick">登录</button>
                </div>
            </div>
        </form>
      </div>
    </div>
</template>

<script>
import axios from 'axios'
import qs from 'qs'
import $ from 'jquery'
export default {
    data(){
        return {
            password:'',
            userName:''
        }
    },
    methods:{
        loginClick(){
            if(this.userName && this.password){
                 localStorage.setItem('user','user')
                //  axios.get('http://zhixinweixue.gotoip4.com/zx-api')
                //  .then(res=>{
                //      console.log(res)
                //  })
                if(this.$route.query.redirect){
                    this.$router.push(this.$route.query.redirect);
                }else{
                   this.$router.push('/home');
                }
                localStorage.setItem(this.userName,this.password)
                
            }else{
                alert('请输入账号名或密码')
        }
    }
}
}
</script>

<style scoped>
.login-wp{
    width: 600px;
    margin: 60px auto;
    background: #eee;
    height: 200px;
    text-align: center
}
.login-wp .login-main{
    padding: 50px 50px 50px 0;
}
</style>